<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>面谈信息</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
	<div class="Wrapper">
		<form id="formSet1">
			<div class="fieldset1 tabel_col clearFix">
				<div class="fieldBox col_50">
					<div class="label">客户经理评级</div>
					<div class="field">
						<select name="cstMgrLvlCd" id="cstMgrLvlCd" data-value=" ">
							<option value=" " checked >--请选择--</option>
							<c:forEach items="${cstMgrLvlCdList }" var="kv">
								<option value="${kv.key }">${kv.value }</option>
							</c:forEach>
						</select>
					</div>
				</div>
				<div class="fieldBox col_50">
					<div class="label">运营年限</div>
					<div class="field">
						<select name="operateTmCd" id="operateTmCd" data-value=" ">
							<option value=" " checked >--请选择--</option>
							<c:forEach items="${operateTmCdList }" var="kv">
								<option value="${kv.key }">${kv.value }</option>
							</c:forEach>
						</select>
					</div>
				</div>
				<div class="fieldBox col_50">
					<div class="label">本地生活年限</div>
					<div class="field">
						<select name="localLiveTmCd" id="localLiveTmCd" data-value=" ">
							<option value=" " checked >--请选择--</option>
							<c:forEach items="${localLiveTmCdList }" var="kv">
								<option value="${kv.key }">${kv.value }</option>
							</c:forEach>
						</select>
					</div>
				</div>
				<div class="fieldBox col_50">
					<div class="label">第二还款来源</div>
					<div class="field">
						<select name="secondPayResCd" id="secondPayResCd" data-value=" ">
							<option value=" " checked >--请选择--</option>
							<c:forEach items="${secondPayResCdList }" var="kv">
								<option value="${kv.key }">${kv.value }</option>
							</c:forEach>
						</select>
					</div>
				</div>
				<div class="fieldBox col_50">
					<div class="label">资产状况</div>
					<div class="field">
						<select name="assetStatusCd" id="assetStatusCd" data-value=" ">
							<option value=" " checked >--请选择--</option>
							<c:forEach items="${assetStatusCdList }" var="kv">
								<option value="${kv.key }">${kv.value }</option>
							</c:forEach>
						</select>
					</div>
				</div>
				<div class="fieldBox col_50">
					<div class="label">司机情况</div>
					<div class="field">
						<select name="driverCd" id="driverCd" data-value=" ">
							<option value=" " checked >--请选择--</option>
							<c:forEach items="${driverCdList }" var="kv">
								<option value="${kv.key }">${kv.value }</option>
							</c:forEach>
						</select>
					</div>
				</div>
				<div class="fieldBox col_50">
					<div class="label">婚姻状况</div>
					<div class="field">
						<select name="marrStatusCd" id="marrStatusCd" data-value=" ">
							<option value=" " checked >--请选择--</option>
							<c:forEach items="${marrStatusCdList }" var="kv">
								<option value="${kv.key }">${kv.value }</option>
							</c:forEach>
						</select>
					</div>
				</div>
				<div class="fieldBox col_50">
					<div class="label">运力来源</div>
					<div class="field">
						<select name="gdsResCd" id="gdsResCd" data-value=" ">
							<option value=" " checked >--请选择--</option>
							<c:forEach items="${gdsResCdList }" var="kv">
								<option value="${kv.key }">${kv.value }</option>
							</c:forEach>
						</select>
					</div>
				</div>
				<div class="fieldBox col_50">
					<div class="label">运营路线</div>
					<div class="field">
						<input name="operateLine" id="operateLine" type="text" class="ui-textbox" value="" >
					</div>
				</div>
				<div class="fieldBox col_50">
					<div class="label">首付款来源</div>
					<div class="field">
						<select name="firstPayResCd" id="firstPayResCd" data-value=" ">
							<option value=" " checked >--请选择--</option>
							<c:forEach items="${firstPayResCdList }" var="kv">
								<option value="${kv.key }">${kv.value }</option>
							</c:forEach>
						</select>
					</div>
				</div>
				<div class="fieldBox col_50">
					<div class="label">品牌</div>
					<div class="field">
						<input name="br" id="br" type="text" class="ui-textbox" value="" >
					</div>
				</div>
				<div class="fieldBox col_50">
					<div class="label">结算方式</div>
					<div class="field">
						<select name="stlWayCd" id="stlWayCd" data-value=" ">
							<option value=" " checked >--请选择--</option>
							<c:forEach items="${stlWayCdList }" var="kv">
								<option value="${kv.key }">${kv.value }</option>
							</c:forEach>
						</select>
					</div>
				</div>
				<div class="fieldBox col_50">
					<div class="label">主货物大类</div>
					<div class="field">
						<select name="mainGdsTypCd" id="mainGdsTypCd" data-value=" " onchange="getTripGoodsSubCd();">
							<option value=" " checked >--请选择--</option>
							<c:forEach items="${mainGdsTypCdList }" var="kv">
								<option value="${kv.key }">${kv.value }</option>
							</c:forEach>
						</select>
					</div>
				</div>
				<div class="fieldBox col_50">
					<div class="label">主运输货物</div>
					<div class="field">
						<select name="gdsTypCd" id="gdsTypCd" data-value=" ">
						</select>
					</div>
				</div>
				<div class="fieldBox col_50">
					<div class="label">风控评级</div>
					<div class="field">
						<select name="riskCtrlLvlCd" id="riskCtrlLvlCd" data-value=" ">
							<option value=" " checked >--请选择--</option>
							<c:forEach items="${riskCtrlLvlCdList }" var="kv">
								<option value="${kv.key }">${kv.value }</option>
							</c:forEach>
						</select>
					</div>
				</div>
			</div>
			<div class="btnsBox">
				<!-- initData后对其赋值 用于判断Add or Modify 并不用来初始化数据 -->
				<input name="interId" id="interId" type="hidden" value="">
			</div>
		</form>
	</div>

<script type="text/javascript">
var _projectId = '${projectId}'; //项目ID
var _proIntId = '${proIntId}'; //流程实例ID
$(function(){
	$('#formSet1').ligerForm({
        validate : true
	});
	initData();
});
//定义父级调用事件
frameElement.dialog.onOk = function () {
	save();
}
frameElement.dialog.onCancel = function () {
	frameElement.dialog.close();
}

var mainData;
	//请求后台数据 (项目ID)
	function initData(){
	   	var _url = '<%=path%>/audit/audInterviewInfo/getByPrjId.do';
	   	$.ajax({
	   		type: 'get',
	   		dataType:'json',
	   		data:{projectId:_projectId},
	   		url: _url,
	   		success:function(msg){
				if(msg.success == 1){
					setData(msg.data);//设置数据
					mainData = msg.data;
				}else{
					$.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
				}
	   		}
	   	});
  	}
		
	//设置页面数据
    function setData(data){
    	$("#interId").val(data.id);//ID
    	var form = liger.get("formSet1");
    	form.setData({
    		cstMgrLvlCd:data.cstMgrLvlCd,
    		operateTmCd:data.operateTmCd,
    		localLiveTmCd:data.localLiveTmCd,
    		secondPayResCd:data.secondPayResCd,
    		assetStatusCd:data.assetStatusCd,
    		driverCd:data.driverCd,
    		marrStatusCd:data.marrStatusCd,
    		gdsResCd:data.gdsResCd,
    		firstPayResCd:data.firstPayResCd,
    		stlWayCd:data.stlWayCd,
    		mainGdsTypCd:data.mainGdsTypCd,
    		riskCtrlLvlCd:data.riskCtrlLvlCd,
    	});
    	$("#operateLine").val(data.operateLine);
    	$("#br").val(data.br);
    	getTripGoodsSubCd();
	};
	//主货物大类change事件
	function getTripGoodsSubCd(){
		var _PCode = $("#mainGdsTypCd").val();
		if(!_PCode) return;
		$.ajax({
			type: 'post',
			dataType:'json',
			data:{PCode:_PCode},
			url: '<%=path%>/audit/audCreditInfo/getGoodsTypJSON.do',
			success:function(msg){
				if(msg.success == 1){
					//主运输货物
					var gdsTypCd = $("#gdsTypCd");
					if(gdsTypCd.length){
						$("#gdsTypCd").empty();
						$("#gdsTypCd").append("<option value=''>--请选择--</option>");
						$.each(msg.data,function(index,obj) {
							var option = "<option value='"+obj.key+"'>"+obj.value+"</option>";
								$(option).appendTo("#gdsTypCd");
								liger.get("gdsTypCd").setSelect();
						});
						$("#gdsTypCd").add_ligerFormEditor();
					}
					SetIframe_height();
					if(mainData){
						var form = liger.get("formSet1");
						form.setData({
							gdsTypCd:mainData.gdsTypCd,
						});
					}
				}else{
					top.$.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
				}
			}
		});
	}
	function save(){
		var form = liger.get("formSet1");
	    if (!form.valid()) {
	    	$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO , SQ_type: "warning" });
            return false; 
        }
	    var data = form.getData();
		var id = $("#interId").val();
	   	var url='<%=path%>/audit/audInterviewInfo/add.do';
	   	if(id != ""){
	    	url = '<%=path%>/audit/audInterviewInfo/modify.do';
	    	data["id"]= id;
	    }
	   	data["projectId"]= _projectId;//项目ID
	   	data["proIntId"]= _proIntId;//流程实例ID
	   	var wait_dialog;
	    $.ajax({
			type: 'post',
			dataType:'json',
			data:data,
			url: url,
			beforeSend: function(){
		          wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
		     },
			success:function(msg){
				wait_dialog.close();
				 if(msg.success == 1){
					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
					 if(msg.data){
						 $("#interId").val(msg.data);
					 }
					 frameElement.dialog.close();
				 }else{
					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
				 }
			}
		})
	}
</script>

</body>
</html>
